<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Expanding Cards</title>
    <link rel="stylesheet" href="./css/reset.css" />
    <style>
      * {
        box-sizing: border-box;
      }
      body {
        font-family: "Muli" sans-serif;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        overflow: hidden;
        margin: 0;
      }
      .container {
        display: flex;
        width: 90vw;
      }
      .panel {
        height: 100vh;
        border-radius: 50px;
        cursor: pointer;
        flex: 0.5;
        margin: 10px;
        position: relative;
        transition: all 0.7s ease-in;
      }
      .panel h3 {
        font-size: 24px;
        position: absolute;
        bottom: 20px;
        left: 20px;
        opacity: 0;
      }
      .panel.active {
        flex: 5;
      }
      .panel.active h3 {
        opacity: 1;
        transition: opacity 0.3s ease-in 0.4s;
      }
    </style>
    <script>
      window.onload = function () {
        let panels = document.querySelectorAll(".panel");
        panels.forEach((panel) => {
          panel.addEventListener("click", () => {
            removeEventClasses();
            panel.classList.add("active");
          });
        });
        function removeEventClasses() {
          panels.forEach((panel) => {
            panel.classList.remove("active");
          });
        }
      };
    </script>
  </head>
  <body>
    <div class="container">
      <div
        class="panel active"
        style="
          background: url(./images/1131.jpg);
          background-size: cover;
          background-position: center;
          background-repeat: no-repeat;
        "
      >
        <h3>1</h3>
      </div>
      <div
        class="panel"
        style="
          background: url(./images/swiper1.jpg);
          background-size: cover;
          background-position: center;
          background-repeat: no-repeat;
        "
      >
        <h3>2</h3>
      </div>
      <div
        class="panel"
        style="
          background: url(./images/swiper2.jpg);
          background-size: cover;
          background-position: center;
          background-repeat: no-repeat;
        "
      >
        <h3>3</h3>
      </div>
      <div
        class="panel"
        style="
          background: url(./images/swiper3.jpg);
          background-size: cover;
          background-position: center;
          background-repeat: no-repeat;
        "
      >
        <h3>4</h3>
      </div>
      <div
        class="panel"
        style="
          background: url(./images/swiper4.jpg);
          background-size: cover;
          background-position: center;
          background-repeat: no-repeat;
        "
      >
        <h3>5</h3>
      </div>
    </div>
  </body>
</html>
